alert("Cannot access stumbleupon.com at this time.\nPlease check your network connection and try again.");
return false;
}
if (res.status != 200)
{
alert("The stumbleupon.com server is currently down.\nPlease try again, and if this occurs frequently,\ngo to http://www.stumbleupon.com/feedback.php to report the problem\nError : " + res.error + "\nStatus : " + res.status);
return false;
}
var s = "";
if (typeof(res.response) != "undefined")
s = res.response;
if (opener.su_log_communication)
opener.su_log("response userexists.php", s);
var commands = s.split("\n");
// Iterate through commands
var success = false;
var i;
for (i = 0; i < commands.length; i++)
{
if (commands[i] == "")
continue;
// Parse command structure
var parts = commands[i].split(" ");
switch(parts[0])
{
case "ERROR":
var msg;
if (parts[1] == "DATABASE_FAILURE")
{
alert("The www.stumbleupon.com server is currently down.\nPlease try again, and if you are still having difficulties,\ngo to http://www.stumbleupon.com/feedback.php to report the problem\nError : " + ss[1]);
return false;
}
else if (parts[1] == "NO_SUCH_USERNAME")
{
msg = "An account was not found for '" + username + "'.\n";
// we need to clear out that username from the list of usernames
var id_list = opener.su_ds.getValue("@id_list");
var splitids = id_list.split(":");
var foundit = 0;
var newarray = new Array();
var line;
for (i = 0; i < splitids.length; i++)
{
if (splitids[i] == "")
continue;
line = splitids[i];
if (line == username)
foundit = 1;
else
newarray.push(line);
}
if (foundit)
{
// add this id to the end
id_list = '';
for (i = 0; i < newarray.length; i++)
{
if (newarray[i] == "")
continue;
line = newarray[i];
id_list += line + ":";
}
opener.su_ds.setValue("@id_list", id_list);
opener.su_ds.flushPrefs();
}
}
else if (parts[1] == "INCORRECT_PASSWORD")
{
msg = "That password for '" + username + "' is incorrect.\n";
}
if (confirm(msg + "Would you like to recover your username/password?"))